using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Dal.Entities;

namespace Dal.Mapping
{
	public class UserMap : EntityTypeConfiguration<User>
	{
		public UserMap()
		{
			// Primary Key
			this.HasKey(t => t.ID);

			// Properties
			this.Property(t => t.UserName)
				.IsRequired()
				.HasMaxLength(50);
				
			this.Property(t => t.Password)
				.IsRequired()
				.HasMaxLength(50);
				
			this.Property(t => t.HospitalName)
				.HasMaxLength(50);
				
			this.Property(t => t.DoctorName)
				.HasMaxLength(50);
				
			this.Property(t => t.DoctorMobile)
				.HasMaxLength(50);
				
			this.Property(t => t.SubjectName)
				.HasMaxLength(50);
				
			this.Property(t => t.TitleName)
				.HasMaxLength(50);
				
			this.Property(t => t.PatientCount)
				.HasMaxLength(50);
				
			this.Property(t => t.PatientYiYuCount)
				.HasMaxLength(50);
				
			this.Property(t => t.AdditionSubjectName)
				.HasMaxLength(50);
				
			this.Property(t => t.AdditionTitleName)
				.HasMaxLength(50);
				
			// Table & Column Mappings
			this.ToTable("User");
			this.Property(t => t.ID).HasColumnName("ID");
			this.Property(t => t.UserName).HasColumnName("UserName");
			this.Property(t => t.Password).HasColumnName("Password");
			this.Property(t => t.Role).HasColumnName("Role");
			this.Property(t => t.ProvinceID).HasColumnName("ProvinceID");
			this.Property(t => t.CityID).HasColumnName("CityID");
			this.Property(t => t.HospitalName).HasColumnName("HospitalName");
			this.Property(t => t.DoctorName).HasColumnName("DoctorName");
			this.Property(t => t.DoctorMobile).HasColumnName("DoctorMobile");
			this.Property(t => t.SubjectName).HasColumnName("SubjectName");
			this.Property(t => t.TitleName).HasColumnName("TitleName");
			this.Property(t => t.PatientCount).HasColumnName("PatientCount");
			this.Property(t => t.PatientYiYuCount).HasColumnName("PatientYiYuCount");
			this.Property(t => t.AdditionSubjectName).HasColumnName("AdditionSubjectName");
			this.Property(t => t.AdditionTitleName).HasColumnName("AdditionTitleName");
		}
	}
}

